
const { ImageShift } = require('../uploadImage/uploadImage');//图库接口nas
// const { ImageShift } = require('../uploadImage/user_img1');//图库接口小飞机
// const { ImageShift } = require('../uploadImage/dd1_img');//图库接口滴滴
async function game_Images(images) {
  if (!images) {
    console.log('game_detail_images 为空');
    return;
  }
  if (Array.isArray(images)) {
    console.log('game_detail_images 是数组类型');
    console.log({ images });
    modifiedArray = [];
    for (let index = 0; index < images.length; index++) {
      // const element = ;
      let modifiedItem = await ImageShift(images[index])
      // console.log(modifiedItem);
      if (!modifiedItem.url) {
        return '出错'
      }
      modifiedArray.push(modifiedItem.url ? modifiedItem.url : modifiedItem);

    }
    console.log(modifiedArray);
    return modifiedArray;
  } else {
    console.log('game_detail_images 不是数组类型');
    // console.log({ images });
    let modifiedItem = await ImageShift(images)
    if (!modifiedItem.url) {
      return '出错'
    }
    return modifiedItem.url;
  }
}
// const dawd = game_Images([
//   'https://play-lh.googleusercontent.com/cmLJnuhx4k2J8JrSDhToPPG-XmBSyfdM9TejS3xLuYGNgDsOSYxI5FtoN7kFHjzj0TI=w526-h296-rw',
//   'https://play-lh.googleusercontent.com/CUx_a7Mm3Dr0iydjbkGmFTLboPCYRgKn86CF_koirh2sz54uCNfk-xw1kphCjKVkFw=w526-h296-rw',
//   'https://play-lh.googleusercontent.com/dorrQ3kq5XeQ9uohfxRnzC793XJl_vV_dnfWJAdqIhcd3pDqYFInlHA0CzFjqLSifQ=w526-h296-rw',
//   'https://play-lh.googleusercontent.com/-JUsivJatgLz3aYBAw5hQY16a-u3YidR1Hqq_O4Y_0Glcj4WTWzzDTgi5jT3kC2RMQ=w526-h296-rw',
//   'https://play-lh.googleusercontent.com/7ClhbATjI59BxU1AVQZ6w_8oWJnguVYI6D2GGPAITFvXPICsveOFppa-lLYB4VdIMBU=w526-h296-rw',
//   'https://play-lh.googleusercontent.com/2wzlzmkEpZw60fVGu51TTIRNBkyA0Vo2lFeq6erVHKXwzSpRSlDD4sjgZUamnvyCHTU=w526-h296-rw'
// ])
// console.log({ dawd });
// async function test() {
//  a = await game_Images('https://play-lh.googleusercontent.com/jedYutIqGe076rYH6VIt2MXzxBv4yEN_fSiqH74vQkQMoKli5knqOP7TtibbSReWtw=w240-h480-rw')
//   // console.log({a});
// }
// test()


module.exports = game_Images